package com.guochenglang.www.service;

import com.guochenglang.www.pojo.Article;
import com.guochenglang.www.pojo.Files;
import com.guochenglang.www.pojo.Page;
import com.guochenglang.www.service.anotate.Affair;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author GuoChenglang
 */
public interface ArticleService {


    /**
     * 阅读文章
     *
     * @param article 文章信息
     * @return 文章
     */
    Article readArticle(Article article);

    /**
     * 按时间展现文章
     *
     * @param page 页数
     * @param num  每页几条文章
     * @return 文章
     * @throws SQLException           sql异常
     * @throws InterruptedException   终端异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 异常
     */
    Page<Article> allArticleByDate(Integer page, Integer num) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 按点赞数展现文章
     *
     * @param page 页码
     * @param num  每页几条
     * @return 文章
     * @throws SQLException           sql异常
     * @throws InterruptedException   异常
     * @throws IllegalAccessException 异常
     * @throws InstantiationException 异常
     */
    Page<Article> allArticleByLike(Integer page, Integer num) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 发布文章
     *
     * @param article 文章信息
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    @Affair
    int publishArticle(Article article) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 上传图片
     *
     * @param files 图片信息
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    @Affair
    int uploadFiles(Files files) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 展现图片
     *
     * @param articleId 文章id
     * @return 执行结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Files> showFiles(Integer articleId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获得文章总数
     *
     * @return 返回文章长度
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    int getSize() throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获取知识库的所有文章
     *
     * @param baseId 知识库id
     * @return 文章列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Article> baseArticle(Integer baseId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除文章
     *
     * @param articleId 文章的id
     * @return 删除结果
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 异常
     */
    @Affair
    int deleteArticle(Integer articleId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 根据id获取具体文章
     *
     * @param articleId 文章的id
     * @return 具体文章
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    Article getArticle(Integer articleId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
